package Es

import (
	"B/renrenzhuB_srv/appconfig"
	"fmt"
	"github.com/elastic/go-elasticsearch/v7"
)

var (
	Es  *elasticsearch.Client
	err error
)

func Elasticsearch() {
	appconf := appconfig.Conf.Es
	cfg := elasticsearch.Config{
		Addresses: []string{
			appconf.Post,
		},
		// ...
	}
	fmt.Println(cfg.Addresses)
	Es, err = elasticsearch.NewClient(cfg)
	if err != nil {
		panic(err)
	}
	fmt.Println("Es初始化成功")
}
